package cn.itcast.nems.oldems.service.impl;

import cn.itcast.nems.manager.util.CustomBeanUtil;
import cn.itcast.nems.oldems.dao.dataobject.PaymentOrderDO;
import cn.itcast.nems.oldems.dao.entiry.PaymentOrder;
import cn.itcast.nems.oldems.dao.mapper.PaymentOrderMapper;
import cn.itcast.nems.oldems.dto.EmsPaymentOrderDTO;
import cn.itcast.nems.oldems.service.PaymentOrderService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Service
@RequiredArgsConstructor
@Slf4j
public class PaymentOrderServiceImpl implements PaymentOrderService {
    private final PaymentOrderMapper paymentOrderMapper ;

    @Override
    public List<EmsPaymentOrderDTO> findListByCreatedTime(Date createdTime,List<String> historyIds ) {
        List<PaymentOrderDO> list = paymentOrderMapper.findListByCreateTime(createdTime ,historyIds);
        return CollectionUtils.isEmpty(list) ? null :
                list.stream().map(item -> CustomBeanUtil.copyProperties(item, new EmsPaymentOrderDTO())).collect(Collectors.toList());
    }
}
